<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>物料退货维护</title>
	<jsp:include page="easyuiIncludeJS.jsp"></jsp:include>
</head>
<body onload="setreadonly(true);">
   <script type="text/javascript">
   		var isautocode="";
   		var materialId;
   		var materialCode;
   		var materialUnit;//获取单位控件名称
   		var materialname;//获取物料控件的值
   		var style;//获取规格型号
   		var batchNo;
   		var orderFlag;
   		var rowstatus=false;//初始状态为不可编辑
   		var str ="拨出位置和拨入位置不能相同";
   		var lastIndex=0;
   		var bAdd=false;
   		var m_storageId;
   		var storageId;
   		var storageName;
   		var remainCnt;
   		var orderCnt;

	   $(function(){
	   		
			$('#dgitem').datagrid({
				toolbar:[{
					text:'添加',
					iconCls:'icon-add',
					handler:function(){
						rowstatus=true;//可编辑
						$('#dgitem').datagrid('endEdit', lastIndex);
						var rows = $("#dgitem").datagrid("getRows"); 
						
						if($("#aduitStatus").val() !="0"){
							alert("已审核的单据不能添加");
							return;
						}
						if($("#invalid").val() =="0"){
							alert("已作废的单据不能添加");
							return;
						}
						$('#dgitem').datagrid('appendRow',{
							orderDetailId:'',
							storageId:0,
							materialId:0,
							storageName:'',
							materialCode:'',
							materialName:'',
							style:'',
							materialUnit:'',
							orderId:'',
							batchNo:'',
							orderCnt:'',
							bagCnt:'',
							orderFlag:'0',
							remainCnt:'0'
						});
						lastIndex = $('#dgitem').datagrid('getRows').length-1;
						$('#dgitem').datagrid('selectRow', lastIndex);
						$('#dgitem').datagrid('beginEdit', lastIndex);
						//设置为只读
						materialName = getEditRow(lastIndex,'materialName');
						$(materialName.target).prop('readonly',true);
						style = getEditRow(lastIndex,'style');
						$(style.target).prop('readonly',true);
						materialUnit = getEditRow(lastIndex,'materialUnit');
						$(materialUnit.target).prop('readonly',true);
						materialCode = getEditRow(lastIndex,'materialCode');
						$(materialCode.target).prop('readonly',true);
						remainCnt = getEditRow(lastIndex,'remainCnt');
						$(remainCnt.target).prop('readonly',true);
						storageName = getEditRow(lastIndex,'storageName');
						$(storageName.target).combogrid({
							panelWidth:300,
							value:'storageName',
							idField:'storageName',
							textField:'storageName',
							columns:[[
								{field:'storageId',title:'仓库id',width:60},
								{field:'storageCode',title:'仓库编号',width:100},
								{field:'storageName',title:'库存名称',width:120}
							]],onSelect:function(idx,row) {
								storageId = getEditRow(lastIndex,'storageId');
					        	$(storageId.target).val(row.storageId);
					        	m_storageId=row.storageId;
					        },onChange:function(idx,row){
					        	
					        }
						});
						var url='${pageContext.request.contextPath }/admin/order/storageList';
			         	$.post(
							url,
							{},
							function(data){
								$(storageName.target).combogrid('grid').datagrid('loadData', data.storageList);
							},
							'json'
						);
						orderId = getEditRow(lastIndex,'orderId');
						$(orderId.target).combogrid({
							panelWidth:750,
							value:'orderId',
							idField:'orderId',
							textField:'orderId',
							columns:[[
								{field:'orderId',title:'订单号',width:100},
								{field:'batchNo',title:'批号',width:140},
								{field:'orderCnt',title:'库存数量',width:70},
								{field:'materialId',title:'ID',width:60},
								{field:'materialCode',title:'编码',width:60},
								{field:'materialName',title:'名称',width:120},
								{field:'style',title:'规格',width:80},
								{field:'materialUnit',title:'单位',width:60}
							]],onSelect:function(idx,row) {
								batchNo = getEditRow(lastIndex,'batchNo');
								$(batchNo.target).val(row.batchNo);
								remainCnt = getEditRow(lastIndex,'remainCnt');
								$(remainCnt.target).val(row.orderCnt);
								orderCnt = getEditRow(lastIndex,'orderCnt');
								$(orderCnt.target).val(row.orderCnt);
								materialId = getEditRow(lastIndex,'materialId');
								$(materialId.target).val(row.materialId);
								materialcode = getEditRow(lastIndex,'materialCode');
								$(materialcode.target).val(row.materialCode);
								materialname = getEditRow(lastIndex,'materialName');
								$(materialname.target).val(row.materialName);
								style = getEditRow(lastIndex,'style');
								$(style.target).val(row.style);
								materialUnit = getEditRow(lastIndex,'materialUnit');
								$(materialUnit.target).val(row.materialUnit);
					        },onChange:function(n,o){
					        	
					        }
						});
						
						$(orderId.target).combogrid('textbox').keyup(function(event) { 
							var txt = $(orderId.target).combogrid('getText');
							changeMaterialCheck(txt,orderId);
						});
						m_storageId='';
					}
				},'-',{
					text:'删除',
					iconCls:'icon-remove',
					handler:function(){
						if($("#aduitStatus").val() !="0"){
							alert("已审核的单据不能删除");
							return;
						}
						if($("#invalid").val() =="0"){
							alert("已作废的单据不能删除");
							return;
						}
						var row = $('#dgitem').datagrid('getSelections');
						if(row==null)
							return;
						rowstatus=false;
						if(row.length==0)
							return;
						if(!confirm('删除确认')){
							return;
						}
						var ids="";
						for(var i=0;i<row.length;i++){
							var index = $('#dgitem').datagrid('getRowIndex', row[i]);
							if(row[i].orderDetailId !="")
							{
								ids += row[i].orderDetailId +",";
							}else{
								$('#dgitem').datagrid('deleteRow', index);
							}
						}
						if(ids !=""){
							delRow(ids);
						}
						lastIndex=0;
					}
				}],
				onBeforeLoad:function(){
					$(this).datagrid('rejectChanges');
				},
				onLoadSuccess:function(){
						
				},
				onClickRow:function(rowIndex){
					//获取选中的第一行
					if(!rowstatus)
						return;
					if($("#aduitStatus").val() !="0"){
						alert("已审核的单据不能修改");
						return;
					}
					if($("#invalid").val() =="0"){
						alert("已作废的单据不能修改");
						return;
					}
					$('#dgitem').datagrid('acceptChanges');
					$('#dgitem').datagrid('selectRow', rowIndex);
					$('#dgitem').datagrid('beginEdit', rowIndex);
					lastIndex=rowIndex;
					//设置为只读
					materialName = getEditRow(lastIndex,'materialName');
					$(materialName.target).prop('readonly',true);
					style = getEditRow(lastIndex,'style');
					$(style.target).prop('readonly',true);
					materialUnit = getEditRow(lastIndex,'materialUnit');
					$(materialUnit.target).prop('readonly',true);
					materialCode = getEditRow(lastIndex,'materialCode');
					$(materialCode.target).prop('readonly',true);
					remainCnt = getEditRow(lastIndex,'remainCnt');
					$(remainCnt.target).prop('readonly',true);
					var row = $('#dgitem').datagrid('getSelected');
					storageName = getEditRow(lastIndex,'storageName');
					$(storageName.target).combogrid({
						panelWidth:300,
						value:'storageName',
						idField:'storageName',
						textField:'storageName',
						columns:[[
							{field:'storageId',title:'仓库id',width:60},
							{field:'storageCode',title:'仓库编号',width:100},
							{field:'storageName',title:'库存名称',width:120}
						]],onSelect:function(idx,row) {
							storageId = getEditRow(lastIndex,'storageId');
				        	$(storageId.target).val(row.storageId);
				        	m_storageId=row.storageId;
				        },onChange:function(n,o){
				        	
				        }
					});
					var url='${pageContext.request.contextPath }/admin/order/storageList';
		         	$.post(
						url,
						{},
						function(data){
							$(storageName.target).combogrid("grid").datagrid("loadData", data.storageList);
						},
						'json'
					);
					
					orderId = getEditRow(lastIndex,'orderId');
					$(orderId.target).combogrid({
						panelWidth:750,
						value:'orderId',
						idField:'orderId',
						textField:'orderId',
						columns:[[
							{field:'orderId',title:'订单号',width:100},
							{field:'batchNo',title:'批号',width:140},
							{field:'orderCnt',title:'库存数量',width:70},
							{field:'materialId',title:'ID',width:60},
							{field:'materialCode',title:'编码',width:60},
							{field:'materialName',title:'名称',width:120},
							{field:'style',title:'规格',width:80},
							{field:'materialUnit',title:'单位',width:60}
						]],onSelect:function(idx,row) {
							batchNo = getEditRow(lastIndex,'batchNo');
							$(batchNo.target).val(row.batchNo);
							remainCnt = getEditRow(lastIndex,'remainCnt');
							$(remainCnt.target).val(row.orderCnt);
							orderCnt = getEditRow(lastIndex,'orderCnt');
							$(orderCnt.target).val(row.orderCnt);
							materialId = getEditRow(lastIndex,'materialId');
							$(materialId.target).val(row.materialId);
							materialcode = getEditRow(lastIndex,'materialCode');
							$(materialcode.target).val(row.materialCode);
							materialname = getEditRow(lastIndex,'materialName');
							$(materialname.target).val(row.materialName);
							style = getEditRow(lastIndex,'style');
							$(style.target).val(row.style);
							materialUnit = getEditRow(lastIndex,'materialUnit');
							$(materialUnit.target).val(row.materialUnit);
				        },onChange:function(n,o){
				        	
				        }
					});
					$(orderId.target).combogrid('textbox').keyup(function(event) { 
						var txt = $(orderId.target).combogrid('getText');
						changeMaterialCheck(txt,orderId);
					});
					$(storageName.target).combogrid('setValue',row.storageName);
					$(orderId.target).combogrid('setValue',row.orderId);
				},
				onSelect:function(rowIndex,data){
				}
			});
			$('#dgitem').datagrid('hideColumn','storageId');
			$('#dgitem').datagrid('hideColumn','materialId');
			$('#dgitem').datagrid('hideColumn','remainCnt');
	   		//调入明细数据
	   		var url='${pageContext.request.contextPath }/admin/orderBack/getDetail';
         	$.post(
				url,
				{
					"orderNo":$("#orderNo").val()
				},
				function(data){
					$('#dgitem').datagrid('loadData',data.detailList);  
					//statisticcount();
				},
				"json"
			);
			$('#dgitem').datagrid('resize', {
				height:document.body.clientHeight-205
			});
	   });
	   // 获取需要编辑的控件
		function getEditRow(lastIndex,field){
		    return category = $('#dgitem').datagrid('getEditor', {  
		        index : lastIndex,  
		        field : field
			});
		}
		function save(){
			if($("#orderDate").datebox('getValue')==""){
				alert("请选择开单日期");
				$("#orderDate").focus();
				return false;
			}
			setreadonly(false);
		}
		//修改
		function edit()
		{
			var key = $("#orderNo").val();
			if(key==""){
				alert("单据不存在");
				return;
			}
			if($("#aduitStatus").val() !="0"){
				alert("已审核的单据不能修改");
				return;
			}
			if($("#invalid").val() =="0"){
				alert("已作废的单据不能修改");
				return;
			}
			bAdd=true;			
			rowstatus=true;
			setreadonly(false);
		}
		//取消
		function cancel(){
			$('#dgitem').datagrid('rejectChanges');
			rowstatus=false;
			lastIndex=0;
			setreadonly(true);
		}

		function setreadonly(flag,copy){
			var key = $("#orderNo").val();
			if(key==""){
				bAdd=true;			
				$("form input").prop("readonly", false);
				$("form input").prop("disabled", false);
				$("form select").attr("disabled",false);
				$("form textarea").attr("disabled",false);
				var d = new Date();
				var y = d.getFullYear();
				var m = d.getMonth()+1;
				var d =  d.getDate();
				$("#orderDate").datebox("setValue",y+"-"+m+"-"+d);
				$('#orderDate').datebox('enable');
			}else{
				bAdd=!flag;			
				$("form input").prop("readonly", flag);
				$("form select").attr("disabled",flag);
				$("form input").prop("disabled", flag);
				$("form textarea").attr("disabled",flag);
				if(flag)
					$('#orderDate').datebox('disable');
				else
					$('#orderDate').datebox('enable');
			}
			var td = $("#orderDate").val();
			if(td !="" && td.substring(0,1) !='2'){
				td="20"+td;
				$("#orderDate").datebox("setValue",td.substring(0,10));
			}
			$('#invalid').prop('disabled', true);
			$('#aduitStatus').prop('disabled', true);
			$("#orderNo").prop('readonly',true);
			
		}

		function changeMaterialCheck(n,obj){
			var url='${pageContext.request.contextPath }/admin/orderBack/materialCheckList';
			if(m_storageId==""){
				alert("请选择仓库");
				return;
			}
         	$.post(
				url,
				{
					"orderId":n,
					"storageId":m_storageId,
					"materialId":$("#supplierId").val() //条件供应商条件
				},
				function(data){
					$(obj.target).combogrid("grid").datagrid("loadData", data.dataList);
				},
				"json"
			);
		}
        function addDetail(){
        	if($("#aduitStatus").val() !="0"){
				alert("已审核的单据不能修改");
				return;
			}
        	if($("#invalid").val() =="0"){
				alert("已作废的单据不能修改");
				return;
			}
         	if(!bAdd)
         		return;
         	$('#dgitem').datagrid('acceptChanges');
			var rows = $("#dgitem").datagrid("getRows"); 
			var i;
			var detailData = ""; 
			if(rows.length<=0){
				alert("请添加入库明细数据");
				return;
			}
			for(i=0;i<rows.length;i++)
			{
				//alert(rows[i].orderId);
				if(rows[i].materialCode=="" || rows[i].materialName=="" || rows[i].style=="" || rows[i].materialUnit=="" || rows[i].orderId=="" || rows[i].batchNo=="" || rows[i].orderCnt=="")
				{
					alert("第"+(i+1)+"行的数据有误");
					return;
				}
				if(parseFloat(rows[i].remainCnt)-parseFloat(rows[i].orderCnt)<0){
					
					alert("批号【"+rows[i].batchNo+"】的物料库存不足");
					return;
				}
				detailData+=rows[i].orderDetailId+",";
				detailData+=$("#orderNo").val()+",";
				detailData+=rows[i].materialCode+",";
				detailData+=rows[i].materialName+",";
				detailData+=rows[i].style+",";
				detailData+=rows[i].materialUnit+",";
				detailData+=rows[i].orderId+",";
				detailData+=rows[i].batchNo+",";
				detailData+=rows[i].orderCnt+",";
				detailData+=rows[i].orderFlag+",";
				detailData+=rows[i].storageId+",";
				detailData+=rows[i].storageName+",";
				detailData+=rows[i].materialId+";";
			}
			save();    
	        var url='${pageContext.request.contextPath }/admin/orderBack/save';
         	$.post(
					url,
					{
						"orderNo":$("#orderNo").val(),
						"orderDate":$("#orderDate").datebox("getValue"),
                        "supplierId":$("#supplierId").val(),
						"orderType":$("#orderType").val(),
						"invalid":$("#invalid").val(),
						"aduitStatus":$("#aduitStatus").val(),
						"supplierId":$("#supplierId").val(),
						"remark":$("#remark").val(),
						"detailData":detailData
					},
					function(data){
						if(data.code==0){
							$("#orderNo").val(data.ord.orderNo);
							$("#orderDate").datebox('setValue',data.ord.orderDate.substring(0,10));
							$("#supplierId").val(data.ord.supplierId);
							$("#invalid").val(data.ord.invalid);
							$("#aduitStatus").val(data.ord.aduitStatus);
							$("#remark").val(data.ord.remark);
							rowstatus=false;
							lastIndex=0;
							setreadonly(true);
							bAdd=false;			
							//清空数据
							 var item = $('#dgitem').datagrid('getRows');
				             if (item && data.detailList) {
				                 for (var i = item.length - 1; i >= 0; i--) {
				                     var index = $('#dgitem').datagrid('getRowIndex', item[i]);
				                     $('#dgitem').datagrid('deleteRow', index);
				                 }
				             }
				             if(data.detailList){
								$('#dgitem').datagrid('loadData',data.detailList);  
								//statisticcount();
							}
				            alert("保存成功");
						}else{
							alert(data.errinfo);
						}
					},
					"json"
			);	
         }
         function delRow(detailid)
         {
         	var url='${pageContext.request.contextPath }/admin/orderBack/delRow';
         	$.post(
				url,
				{
					"ids":detailid,
					"orderNo":$("#orderNo").val()
				},
				function(data){
					var item = $('#dgitem').datagrid('getRows');
		             if (item) {
		                 for (var i = item.length - 1; i >= 0; i--) {
		                     var index = $('#dgitem').datagrid('getRowIndex', item[i]);
		                     $('#dgitem').datagrid('deleteRow', index);
		                 }
		             }
					$('#dgitem').datagrid('loadData',data.detailList);  
					//statisticcount();
					//alert(data.msg);
				},
				"json"
			);	
         }
 		//审核单据
 		function aduit()
 		{
 			var ordNo = $("#orderNo").val();
 			if(ordNo==""){
 				alert("单据不存在");
 				return;
 			}
 			if($("#aduitStatus").val() !="0"){
 				alert("单据已审核");
 				return;
 			}
 			if($("#invalid").val() =="0"){
				alert("已作废的单据不能审核");
				return;
			}
 			if(!confirm('是否审核')){
 				return false;
 			}
 			var url='${pageContext.request.contextPath }/admin/orderBack/aduit2';
 			$.post(
 					url,
 					{
 						"orderNo":ordNo
 					},
 					function(data){
 						if(data.code ==0){
 							alert("审核成功");
 							$("#aduitStatus").val(1);
 						}
 					},
 					"json"
 			);
 		}
		//作废单据
		function status()
		{
			var ordNo = $("#orderNo").val();
 			if(ordNo==""){
 				alert("单据不存在");
 				return;
 			}
			if($("#invalid").val() =="0"){
				alert("单据已作废");
				return;
			}
			if($("#aduitStatus").val() !="0"){
 				alert("已审核的单据不能作废");
 				return;
 			}
			if(!confirm('是否作废')){
				return false;
			}
			var url='${pageContext.request.contextPath }/admin/orderBack/status2';
			$.post(
					url,
					{
						"orderNo":ordNo
					},
					function(data){
						if(data.code ==0){
							alert("作废成功");
							$("#invalid").val(0);
						}
					},
					"json"
			);
		}
		//删除单据
		function del()
		{
			var ordNo = $("#orderNo").val();
 			if(ordNo==""){
 				alert("单据不存在");
 				return;
 			}
			if($("#invalid").val() =="0"){
				alert("已作废的单据不能删除");
				return;
			}
			if($("#aduitStatus").val() !="0"){
 				alert("已审核的单据不能删除");
 				return;
 			}
			if(!confirm('是否删除')){
				return false;
			}
			var url='${pageContext.request.contextPath }/admin/orderBack/del2?orderNo='+ordNo;
			location.href=url;
		}

		function add(){
			var url="${pageContext.request.contextPath }/admin/orderBack/init?orderType=2";
			var title="采购退货单新增";
			addTab1(title, url);
		}
		if("${msg}"!=null&&"${msg}".length>0){
				alert("${msg}");
		}

	</script>
		<form theme="simple" action="/admin/orderBack/save" method="post">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" BACKGROUND="images/maintitle.jpg">
		<tr>
			<td align="left">
				<a class="easyui-linkbutton" plain="true" icon="icon-add"  href="javascript:void(0);" onclick="add();">新增</a>
				<a class="easyui-linkbutton" plain="true" icon="icon-edit" href="javascript:void(0);" onclick="edit();">编辑</a>
				<a class="easyui-linkbutton" plain="true" icon="icon-save" href="javascript:void(0);" onclick="addDetail();">保存</a>
				<a class="easyui-linkbutton" plain="true" icon="icon-undo" href="javascript:void(0);" onclick="cancel();">取消</a>
				<a class="easyui-linkbutton" plain="true" icon="icon-cut" href="javascript:void(0);" onclick="del();">删除</a>
				<a class="easyui-linkbutton" plain="true" href="javascript:void(0);" onclick="aduit();">审核</a>
				<a class="easyui-linkbutton" plain="true" href="javascript:void(0);" onclick="status();">作废</a>
			</td>
		</tr>
		</table>
		<input type="hidden" name="orderType" id="orderType" value="2">
		<fieldset>
			<legend>单据信息</legend>
		<table width="980" height="120">
			<tr height="30">
				<td align="right" width="90" style="vertical-align:top">退货日期</td>
				<td width="200" style="vertical-align:top"><input type="text" class="easyui-datebox" name="orderDate" id="orderDate" value="${ord.orderDate}" style="width:155px"></td>
				<td align="right" style="vertical-align:top">供应商</td>
				<td style="vertical-align:top" colspan="3">
					<select name="supplierId" id="supplierId" style="width:520px">
						<c:forEach items="${supplierList }" var="d">
							<c:if test="${ord.supplierId==d.supplierId }">
								<option value="${d.supplierId}" selected="selected">(${d.supplierCode})${d.supplierName}</option>
							</c:if>
							<c:if test="${ord.supplierId!=d.supplierId }">
								<option value="${d.supplierId}">(${d.supplierCode})${d.supplierName}</option>
							</c:if>
						</c:forEach>
					</select>
				</td>
			</tr>
			<tr height="30">
			    <td align="right" width="80">单据编号</td>
			    <td width="200"><input type="text" name="orderNo" id="orderNo" value="${ord.orderNo}" style="width:155px"/></td>
				<td align="right">状态</td>
				<td>
					<select name = "invalid" id="invalid"  style="width:155px" disabled="disabled">
					<c:if test="${ord==null }">
						<option value="1" selected>正常</option>
						<option value="0">作废</option>
					</c:if>
					<c:if test="${ord!=null }">
						<c:if test="${ord.invalid==1}">
							<option value="1" selected>正常</option>
							<option value="0">作废</option>
						</c:if>
						<c:if test="${ord.invalid!=1}">
							<option value="1" >正常</option>
							<option value="0" selected>作废</option>
						</c:if>
					</c:if>
					</select>
				</td>
				<td align="right">审核状态</td>
				<td>
					<select name = "aduitStatus" id="aduitStatus"  style="width:155px" >
						<c:if test="${ord==null }">
							<option value="0" selected>未审核</option>
							<option value="1" >已审核</option>
						</c:if>
						<c:if test="${ord!=null }">
							<c:if test="${ord.aduitStatus==1}">
								<option value="1" selected>已审核</option>
								<option value="0">未审核</option>
							</c:if>
							<c:if test="${ord.aduitStatus!=1}">
								<option value="1" >已审核</option>
								<option value="0" selected>未审核</option>
							</c:if>
						</c:if>
					</select>
				</td>
			</tr>
			<tr height="30">
				<td align="right">备注</td>
				<td colspan="5">
					<input type="text" name="remark" id="remark" value="${ord.remark}" style="width:770px;">
				</td>
			</tr>
			
		</table>
	</fieldset>
	<table id="dgitem"  style="width:auto;height:300px" 
			data-options="iconCls:'icon-edit',singleSelect:true,idField:'orderDetailId',showFooter:true"
			title="退货明细">
		<thead>
			<tr>
				<th data-options="field:'orderDetailId',width:50" checkbox="true" >选择</th>
				<th data-options="field:'storageId',width:50,editor:'text'">仓库Id</th>
				<th data-options="field:'materialId',width:50,editor:'text'">物料Id</th>
				<th data-options="field:'remainCnt',width:50,editor:'text'">库存数量</th>
				<th data-options="field:'storageName',width:150,align:'center',
					editor:{
						type:'combobox',
						options:{
							valueField:'storageCode',
							textField:'storageName',
							required:true
						}
					}">仓库名称</th>
				<th data-options="field:'orderId',width:150,
						editor:{
							type:'combobox',
							options:{
								valueField:'code',
								textField:'name',
								required:true
							}
						}">采购编码</th>
				<th data-options="field:'batchNo',width:150,editor:'text',align:'center'">批号</th>
				<th data-options="field:'materialCode',width:150,align:'center',editor:'text'">物料编码</th>
				<th data-options="field:'materialName',width:150,editor:'text',align:'center'">物料名称</th>
				<th data-options="field:'style',width:150,editor:'text',align:'center'">规格型号</th>
				<th data-options="field:'materialUnit',width:100,editor:'text',align:'center'">单位</th>
				<th data-options="field:'orderCnt',width:100,align:'center',editor:'text'">数量</th>
				<th data-options="field:'orderFlag',width:40,editor:{type:'checkbox',options:{on:'冲红',off:'正常'}}">冲红</th>	
			</tr>
		</thead>
	</table>
		</form>
	</body>
</html>